﻿using XLua;
using WorldMapBase;

public class SampleLuaLayerMgr
{
    private static WorldEntry worldEntry;

    public static void Initialize(WorldEntry w)
    {
        worldEntry = w;
    }

    /// <summary>
    /// 添加一个Lua端的带有LOD功能的层级
    /// </summary>
    /// <param name="table">Lua端对应的表格</param>
    /// <returns>层级对象</returns>
    public static LuaLODLayer AddLuaLODLayer(LuaTable table)
    {
        var layer = new LuaLODLayer(table);
        worldEntry.AddCustomLODLayer(layer);
        return layer;
    }

    /// <summary>
    /// 添加一个Lua端在运行时动态添加的离散分布对象层级
    /// </summary>
    /// <param name="table">Lua端对应的表格</param>
    /// <param name="gridSize">格子尺寸</param>
    /// <returns>层级对象</returns>
    public static LuaDiscreteObjectLODLayer AddLuaDiscreteObjectLODLayer(LuaTable table, int gridSize)
    {
        var layer = new LuaDiscreteObjectLODLayer(table, gridSize, gridSize);
        worldEntry.AddCustomLODLayer(layer);
        return layer;
    }
}
